import Vue from "vue";
import VueRouter from "vue-router";

import Home from "../pages/Home";
import Login from "../pages/Login";
import Music from "../pages/Home/Music";
import News from "../pages/Home/News";

Vue.use(VueRouter);
export default new VueRouter({
  //在实例化路由器对象的配置中,书写路由表配置
  routes: [
    { path: "/login", name: "login", component: Login },
    {
      path: "/home",
      name: "home",
      component: Home,
      children: [
        {
          path: "news/:id/:time?",
          component: News,
          name: "news",
        },
        {
          path: "music",
          component: Music,
          name: "music",
          props:(route)=>{
            return route.query
          }
        },
      ],
    },
    {path:'/',redirect:'/home'}
  ],
});
